﻿using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

namespace News.WebParts.SangTacWebPart
{
    [ToolboxItemAttribute(false)]
    public class SangTacWebPart : WebPart
    {
        // Visual Studio might automatically update this path when you change the Visual Web Part project item.
        private const string _ascxPath = @"~/_CONTROLTEMPLATES/News.WebParts/SangTacWebPart/SangTacWebPartUserControl.ascx";

        protected override void CreateChildControls()
        {
            Control control = Page.LoadControl(_ascxPath);
            var userControl = control as SangTacWebPartUserControl;
            if (userControl != null) userControl.RowLimit = RowLimit;
            Controls.Add(control);
        }

        public int _rowLimit;
        [Category("Settings"),
        Personalizable(PersonalizationScope.Shared),
        WebBrowsable(true),
        WebDisplayName("Row Limit"),
        WebDescription("Row Limit")]
        public int RowLimit
        {
            get { return _rowLimit; }
            set { _rowLimit = value; }
        }


    }
}
